<?php

class Form_SignupForm extends Zend_Form
{
    public function init() 
    {
        parent::init();
        $this->setMethod('post');
        
        $name = $this->createElement('text','name')
                    ->setLabel("Name: ")
                    ->setRequired(true)
                    ->addFilter("alnum");
        
        $name->setDecorators(array('ViewHelper',
                                    'Description',
                                    'Errors',
                                    array(array('data'=>'HtmlTag'), array('tag' => 'td')),
                                    array('Label', array('tag' => 'td')),
                                    array(array('row'=>'HtmlTag'),array('tag'=>'tr')) 
                                ));
        
        $email = $this->createElement('text', 'email')
                    ->setLabel('Email Id:')
                    ->setRequired(true)
                    ->addFilter("StripTags")
                    ->addValidator("EmailAddress");
        
        $email->setDecorators(array(
                'ViewHelper',
                'Description',
                'Errors',
                array(array('data' => 'HtmlTag'), array('tag' => 'td')),
                array('Label', array('tag' => 'td')),
                array(array('row' =>'HtmlTag'), array('tag' => 'tr'))
        ));
        
        $password = $this->createElement('password', 'password')
                        ->setLabel("Password")
                        ->addFilter('Alnum')
                        ->setRequired(true);
        
        $password->setDecorators(array(
                    'ViewHelper',
                    'Description',
                    'Errors',
                    array(array('data' => 'HtmlTag'), array('tag' => 'td')),
                    array('Label', array('tag' => 'td')),
                    array(array('row' => 'HtmlTag'), array('tag' => 'tr'))
        ));
        
        $city = $this->createElement('text', 'city')
                    ->setLabel("City:")
                    ->setRequired(true)
                    ->addFilter("Alnum");
        
        $city->setDecorators(array(
                'ViewHelper',
                'Description',
                'Errors',
                array(array("data" => "HtmlTag"), array('tag' => 'td')),
                array('Label', array('tag' => 'td')),
                array(array('row' => 'HtmlTag'), array('tag' => 'tr'))
        ));
        
        $submit = $this->createElement("submit", 'submit')
                    ->setLabel('SignUp:');
        
        $submit->setDecorators(array(
            'ViewHelper',
            'Description',
            'Errors',
            array(array('data' => 'HtmlTag'),array('tag' => 'td')),
            array(array('row' => 'HtmlTag'),array('tag' => 'tr'))
        ));
        
        $this->addElements(array($name, $email, $password, $city, $submit));
        
        $this->setDecorators(array(
                        'FormElements',
                        array(array('data'=>'HtmlTag'),array('tag'=>'table')),
                        'Form'
                ));
        
    }
}